<?php 
	session_start();
	include 'db_connect.php';
	$c = db_connect_ses('information_schema');
	

	if (isset($_GET['table']))
	{
		$reponse = $c->query("SELECT * FROM TABLES WHERE TABLE_NAME = '".$_GET['table']."'"); 
	}
	else
	{
		$reponse = $c->query('SELECT * FROM TABLES');
	}
	
	echo '<table border=1 cellpadding=1 cellspacing=0 width="90%">'; 
	while ( $row= $reponse->fetch()) 
	{ 
		echo '<tr>'; 
		echo '<td valign="top" align="center">' .$row['TABLE_NAME']. '</td>'; 
		echo '<td>'; 
		$c1 = db_connect_ses($row['TABLE_SCHEMA']);
		$reponse2 = $c1->query('SHOW CREATE TABLE ' .$row['TABLE_NAME']); 
		
		while ( $table_def= $reponse2->fetch()) 
		{ 
				echo '<pre>' .$table_def[1]. '</pre>'; 
		} 
		echo '</tr>'; 
	} 
	echo '</table>'; 

?>

